package executor;

/**
 * @author tongchen
 * @create 2023-01-27 21:56
 */
public class Review {
    private static Object locker=new Object();
    private static int count=0;
    public static void increase(){
        for(int i=0;i<50000;++i){
            count++;
        }
    }
    public static void main(String[] args) throws InterruptedException {
        //创建线程1
         Thread t1 =new Thread(()->{
             synchronized (locker){
                 increase();
             }
                 });
        //创建线程2
         Thread t2 =new Thread(()->{
             synchronized (locker){
                 increase();
             }
                 });
         t1.start();
         t2.start();
         t1.join();
         t2.join();
        System.out.println(count);
    }

}
